<?php
class content_infoModel extends baseModel{
    protected $table = 'content';

    //获取内容基本信息
    public function info($aid,$urltitle=false)
    {
        if(!$urltitle){
            $where='aid='.$aid;
        }else{
            $where='urltitle="'.$aid.'"';
        }

        return $this->find($where);
    }

    //完整内容
    public function info_data($aid,$ext_id)
    {
        if(!empty($ext_id)){
            $model_info=api('expand_model','model_info',$ext_id);
            if(!empty($model_info)){
                $expand="LEFT JOIN {$this->model->pre}expand_content_{$model_info['table']} C ON C.aid = A.aid";
                $expand_field="C.*,";
            }
        }
        $sql="
            SELECT {$expand_field}B.content,A.*
            FROM {$this->model->pre}content A 
            LEFT JOIN {$this->model->pre}content_data B ON B.aid = A.aid
            {$expand}
            WHERE A.aid={$aid} LIMIT 1
        ";
        $info=$this->model->query($sql);
        return $info[0]; 

    }

    

    

}
